<?php
require_once('/js/fckeditor/fckeditor.php');

class Zend_View_Helper_Rte
{
  function rte($name, $value = null, $attr = array())
  {
    $baseUrl = str_replace('/index.php', '', Zend_Controller_Front::getInstance()->getBaseUrl());
    $headLink = new Zend_View_Helper_HeadLink();

    $headScript = new Zend_View_Helper_HeadScript();
    $headScript->headScript()->appendFile($baseUrl.'/js/fckeditor/fckeditor.js');

    $oFCKeditor = new FCKeditor($name) ;
    $oFCKeditor->BasePath = $baseUrl.'/js/fckeditor/';
    $oFCKeditor->Config['SkinPath'] = $oFCKeditor->BasePath."editor/skins/default/";
    if (key_exists('height', $attr)) {
      $oFCKeditor->Height = $attr['height'];
    }

    $oFCKeditor->Value = $value;
  
    return $oFCKeditor->Create();
  }
}
?>